/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "zobjects_gtk.h"

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_Create_guiwindow_string;
int ZlangInvokeFunction_guimenuitem_Create_guiwindow_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*label = NULL ;
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = & (guimenuitem_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in2 , & label , NULL );

	memset( guimenuitem_direct_prop->la_bel , 0x00 , sizeof(guimenuitem_direct_prop->la_bel) );
	snprintf( guimenuitem_direct_prop->la_bel , sizeof(guimenuitem_direct_prop->la_bel)-1 , "%s" , label );
	ReplaceChar( guimenuitem_direct_prop->la_bel , ' ' , '-' );
	memset( guimenuitem_direct_prop->win_la_bel , 0x00 , sizeof(guimenuitem_direct_prop->win_la_bel) );
	snprintf( guimenuitem_direct_prop->win_la_bel , sizeof(guimenuitem_direct_prop->win_la_bel)-1 , "win.%s" , guimenuitem_direct_prop->la_bel );
	guimenuitem_direct_prop->is_checked = BOOLNULL ;
	EVAL_GTK_WIDGET_NEW_IN_CREATE( guimenuitem_common->menu_item , g_menu_item_new(label,guimenuitem_direct_prop->win_la_bel) )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guimenuitem_common->guiwindow_obj , in1 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_Create_guiwindow_string_functionptr;
int ZlangInvokeFunction_guimenuitem_Create_guiwindow_string_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*label = NULL ;
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = & (guimenuitem_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in2 , & label , NULL );

	memset( guimenuitem_direct_prop->la_bel , 0x00 , sizeof(guimenuitem_direct_prop->la_bel) );
	snprintf( guimenuitem_direct_prop->la_bel , sizeof(guimenuitem_direct_prop->la_bel)-1 , "%s" , label );
	ReplaceChar( guimenuitem_direct_prop->la_bel , ' ' , '-' );
	memset( guimenuitem_direct_prop->win_la_bel , 0x00 , sizeof(guimenuitem_direct_prop->win_la_bel) );
	snprintf( guimenuitem_direct_prop->win_la_bel , sizeof(guimenuitem_direct_prop->win_la_bel)-1 , "win.%s" , guimenuitem_direct_prop->la_bel );
	guimenuitem_direct_prop->is_checked = BOOLNULL ;
	EVAL_GTK_WIDGET_NEW_IN_CREATE( guimenuitem_common->menu_item , g_menu_item_new(label,guimenuitem_direct_prop->win_la_bel) )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guimenuitem_common->guiwindow_obj , in1 )

	if( in3 )
	{
		ADD_MENU_ITEM_CALLBACK_IN_CREATE( guimenuitem_common->guiwindow_obj , out1 , guimenuitem_direct_prop->la_bel , GTK_EVENT_ACTIVATE , in3 )
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_Create_guiwindow_string_bool_functionptr;
int ZlangInvokeFunction_guimenuitem_Create_guiwindow_string_bool_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*in4 = GetInputParameterInLocalObjectStack(rt,4) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*label = NULL ;
	unsigned char					is_checked ;
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = & (guimenuitem_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in2 , & label , NULL );
	CallRuntimeFunction_bool_GetBoolValue( rt , in3 , & is_checked );

	memset( guimenuitem_direct_prop->la_bel , 0x00 , sizeof(guimenuitem_direct_prop->la_bel) );
	snprintf( guimenuitem_direct_prop->la_bel , sizeof(guimenuitem_direct_prop->la_bel)-1 , "%s" , label );
	ReplaceChar( guimenuitem_direct_prop->la_bel , ' ' , '-' );
	memset( guimenuitem_direct_prop->win_la_bel , 0x00 , sizeof(guimenuitem_direct_prop->win_la_bel) );
	snprintf( guimenuitem_direct_prop->win_la_bel , sizeof(guimenuitem_direct_prop->win_la_bel)-1 , "win.%s" , guimenuitem_direct_prop->la_bel );
	guimenuitem_direct_prop->is_checked = is_checked ;
	EVAL_GTK_WIDGET_NEW_IN_CREATE( guimenuitem_common->menu_item , g_menu_item_new(label,guimenuitem_direct_prop->win_la_bel) )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guimenuitem_common->guiwindow_obj , in1 )

	if( in4 )
	{
		ADD_MENU_ITEM_CALLBACK_IN_CREATE( guimenuitem_common->guiwindow_obj , out1 , guimenuitem_direct_prop->la_bel , GTK_EVENT_CHANGE_STATE , in4 )
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_SetAcceleratorKey_int_int;
int ZlangInvokeFunction_guimenuitem_SetAcceleratorKey_int_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = (struct ZlangDirectProperty_guiwidget_common *)guimenuitem_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						key_state ;
	int32_t						key_val ;
	GtkShortcutTrigger				*shortcut_trigger = NULL ;
	GtkShortcut					*shortcut = NULL ;
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(guimenuitem_common->guiwindow_obj) ;

	CallRuntimeFunction_int_GetIntValue( rt , in1 , & key_state );
	CallRuntimeFunction_int_GetIntValue( rt , in2 , & key_val );

	shortcut_trigger = gtk_keyval_trigger_new( key_val , key_state ) ;
	shortcut = gtk_shortcut_new( shortcut_trigger , gtk_named_action_new(guimenuitem_direct_prop->win_la_bel) ) ;
	// gtk_shortcut_controller_set_scope( GTK_SHORTCUT_CONTROLLER(guiwindow_direct_prop->shortcut_controller) , GTK_SHORTCUT_SCOPE_GLOBAL );
	// gtk_shortcut_controller_set_scope( GTK_SHORTCUT_CONTROLLER(guiwindow_direct_prop->shortcut_controller) , GTK_SHORTCUT_SCOPE_MANAGED );
	gtk_shortcut_controller_add_shortcut( GTK_SHORTCUT_CONTROLLER(guiwindow_direct_prop->shortcut_controller) , shortcut );		

	/*
	g_object_unref( shortcut_trigger );
	g_object_unref( shortcut );
	*/

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_SetAcceleratorKey_string;
int ZlangInvokeFunction_guimenuitem_SetAcceleratorKey_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = (struct ZlangDirectProperty_guiwidget_common *)guimenuitem_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*shortcut_trigger_string = NULL ;
	unsigned int					key_val ;
	GdkModifierType					key_state ;
	GtkShortcutTrigger				*shortcut_trigger = NULL ;
	GtkShortcut					*shortcut = NULL ;
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(guimenuitem_common->guiwindow_obj) ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & shortcut_trigger_string , NULL );

	gtk_accelerator_parse( shortcut_trigger_string , & key_val , & key_state ) ;
	shortcut_trigger = gtk_keyval_trigger_new( key_val , key_state ) ;
	shortcut = gtk_shortcut_new( shortcut_trigger , gtk_named_action_new(guimenuitem_direct_prop->win_la_bel) ) ;
	// gtk_shortcut_controller_set_scope( GTK_SHORTCUT_CONTROLLER(guiwindow_direct_prop->shortcut_controller) , GTK_SHORTCUT_SCOPE_GLOBAL );
	gtk_shortcut_controller_add_shortcut( GTK_SHORTCUT_CONTROLLER(guiwindow_direct_prop->shortcut_controller) , shortcut );		

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_SetChecked_bool;
int ZlangInvokeFunction_guimenuitem_SetChecked_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = (struct ZlangDirectProperty_guiwidget_common *)guimenuitem_direct_prop ;
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(guimenuitem_common->guiwindow_obj) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	GVariant					*action_name_variant = NULL ;
	const char					*action_name = NULL ;
	GAction						*action = NULL ;
	// GVariant					*variant = NULL ;
	
	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & b );

	action_name_variant = g_menu_item_get_attribute_value( guimenuitem_direct_prop->common.menu_item , "action" , NULL ) ;
	action_name = g_variant_get_string(action_name_variant,NULL) ;
	action = g_action_map_lookup_action( G_ACTION_MAP(guiwindow_direct_prop->action_map) , action_name+4 ) ;
	// variant = g_action_get_state( G_ACTION(action) ) ;
	g_simple_action_set_state( G_SIMPLE_ACTION(action) , g_variant_new_boolean(b) );
	
	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZLANG_INVOKE_FUNCTION_guiwidget_all_common_functions( menuitem )

ZLANG_INVOKE_FUNCTION_guictl_all_common_functions( menuitem )

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_IsChecked;
int ZlangInvokeFunction_guimenuitem_IsChecked( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = (struct ZlangDirectProperty_guiwidget_common *)guimenuitem_direct_prop ;
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(guimenuitem_common->guiwindow_obj) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	GVariant					*action_name_variant = NULL ;
	const char					*action_name = NULL ;
	GAction						*action = NULL ;
	GVariant					*variant = NULL ;
	unsigned char					b ;
	
	action_name_variant = g_menu_item_get_attribute_value( guimenuitem_direct_prop->common.menu_item , "action" , NULL ) ;
	action_name = g_variant_get_string(action_name_variant,NULL) ;
	action = g_action_map_lookup_action( G_ACTION_MAP(guiwindow_direct_prop->action_map) , action_name+4 ) ;
	variant = g_action_get_state( G_ACTION(action) ) ;
	if( variant == NULL )
		b = FALSE ;
	else
		b = g_variant_get_boolean(variant) ;
	
	CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );
	
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guimenuitem_ToggleCheck;
int ZlangInvokeFunction_guimenuitem_ToggleCheck( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guimenuitem		*guimenuitem_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guimenuitem_common = (struct ZlangDirectProperty_guiwidget_common *)guimenuitem_direct_prop ;
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(guimenuitem_common->guiwindow_obj) ;
	GVariant					*action_name_variant = NULL ;
	const char					*action_name = NULL ;
	GAction						*action = NULL ;
	GVariant					*variant = NULL ;
	unsigned char					b ;
	
	action_name_variant = g_menu_item_get_attribute_value( guimenuitem_direct_prop->common.menu_item , "action" , NULL ) ;
	action_name = g_variant_get_string(action_name_variant,NULL) ;
	action = g_action_map_lookup_action( G_ACTION_MAP(guiwindow_direct_prop->action_map) , action_name+4 ) ;
	variant = g_action_get_state( G_ACTION(action) ) ;
	if( variant == NULL )
		b = FALSE ;
	else
		b = g_variant_get_boolean(variant) ;

	b = ! b ;
	g_simple_action_set_state( G_SIMPLE_ACTION(action) , g_variant_new_boolean(b) );
	
	return 0;
}

ZlangCreateDirectPropertyFunction ZlangCreateDirectProperty_guimenuitem;
void *ZlangCreateDirectProperty_guimenuitem( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guimenuitem	*guimenuitem_prop = NULL ;
	
	guimenuitem_prop = (struct ZlangDirectProperty_guimenuitem *)ZLMALLOC( sizeof(struct ZlangDirectProperty_guimenuitem) ) ;
	if( guimenuitem_prop == NULL )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_ALLOC , "alloc memory for entity" )
		return NULL;
	}
	memset( guimenuitem_prop , 0x00 , sizeof(struct ZlangDirectProperty_guimenuitem) );

	INIT_ZLANGDIRECTPROPERTY_guiwidget_common(guimenuitem)
	
	return guimenuitem_prop;
}

ZlangDestroyDirectPropertyFunction ZlangDestroyDirectProperty_guimenuitem;
void ZlangDestroyDirectProperty_guimenuitem( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guimenuitem	*guimenuitem_direct_prop = GetObjectDirectProperty(obj) ;
	
	CLEAN_ZLANGDIRECTPROPERTY_guiwidget_common(guimenuitem)

	if( guimenuitem_direct_prop->common.guiwindow_obj )
	{
		DestroyObject( rt , guimenuitem_direct_prop->common.guiwindow_obj );
	}

	ZLFREE( guimenuitem_direct_prop );
	
	return;
}

ZlangSummarizeDirectPropertySizeFunction ZlangSummarizeDirectPropertySize_guimenuitem;
void ZlangSummarizeDirectPropertySize_guimenuitem( struct ZlangRuntime *rt , struct ZlangObject *obj , size_t *summarized_obj_size , size_t *summarized_direct_prop_size )
{
	SUMMARIZE_SIZE( summarized_direct_prop_size , sizeof(struct ZlangDirectProperty_guimenuitem) )
	return;
}

static struct ZlangDirectFunctions direct_funcs_guimenuitem =
	{
		ZLANG_OBJECT_guimenuitem , /* char *ancestor_name */
		
		ZlangCreateDirectProperty_guimenuitem , /* ZlangCreateDirectPropertyFunction *create_entity_func */
		ZlangDestroyDirectProperty_guimenuitem , /* ZlangDestroyDirectPropertyFunction *destroy_entity_func */
		
		NULL , /* ZlangFromCharPtrFunction *from_char_ptr_func */
		NULL , /* ZlangToStringFunction *to_string_func */
		NULL , /* ZlangFromDataPtrFunction *from_data_ptr_func */
		NULL , /* ZlangGetDataPtrFunction *get_data_ptr_func */
		
		NULL , /* ZlangOperatorFunction *oper_PLUS_func */
		NULL , /* ZlangOperatorFunction *oper_MINUS_func */
		NULL , /* ZlangOperatorFunction *oper_MUL_func */
		NULL , /* ZlangOperatorFunction *oper_DIV_func */
		NULL , /* ZlangOperatorFunction *oper_MOD_func */
		
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NEGATIVE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NOT_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_BIT_REVERSE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_PLUS_PLUS_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_MINUS_MINUS_func */
		
		NULL , /* ZlangCompareFunction *comp_EGUAL_func */
		NULL , /* ZlangCompareFunction *comp_NOTEGUAL_func */
		NULL , /* ZlangCompareFunction *comp_LT_func */
		NULL , /* ZlangCompareFunction *comp_LE_func */
		NULL , /* ZlangCompareFunction *comp_GT_func */
		NULL , /* ZlangCompareFunction *comp_GE_func */
		
		NULL , /* ZlangLogicFunction *logic_AND_func */
		NULL , /* ZlangLogicFunction *logic_OR_func */
		
		NULL , /* ZlangLogicFunction *bit_AND_func */
		NULL , /* ZlangLogicFunction *bit_XOR_func */
		NULL , /* ZlangLogicFunction *bit_OR_func */
		NULL , /* ZlangLogicFunction *bit_MOVELEFT_func */
		NULL , /* ZlangLogicFunction *bit_MOVERIGHT_func */
		
		ZlangSummarizeDirectPropertySize_guimenuitem , /* ZlangSummarizeDirectPropertySizeFunction *summarize_direct_prop_size_func */
	} ;

ZlangImportObjectFunction ZlangImportObject_guimenuitem;
struct ZlangObject *ZlangImportObject_guimenuitem( struct ZlangRuntime *rt )
{
	struct ZlangObject	*obj = NULL ;
	struct ZlangFunction	*func = NULL ;
	int			nret = 0 ;
	
	nret = ImportObject( rt , & obj , ZLANG_OBJECT_guimenuitem , & direct_funcs_guimenuitem , sizeof(struct ZlangDirectFunctions) , NULL ) ;
	if( nret )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_LINK_FUNC_TO_ENTITY , "import object to global objects heap" )
		return NULL;
	}
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_Create_guiwindow_string , ZLANG_OBJECT_guimenuitem , "Create" , ZLANG_OBJECT_guiwindow,NULL , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_Create_guiwindow_string_functionptr , ZLANG_OBJECT_guimenuitem , "Create" , ZLANG_OBJECT_guiwindow,NULL , ZLANG_OBJECT_string,NULL , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_Create_guiwindow_string_bool_functionptr , ZLANG_OBJECT_guimenuitem , "Create" , ZLANG_OBJECT_guiwindow,NULL , ZLANG_OBJECT_string,NULL , ZLANG_OBJECT_bool,NULL , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_SetAcceleratorKey_int_int , ZLANG_OBJECT_guimenuitem , "SetAcceleratorKey" , ZLANG_OBJECT_int,NULL , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_SetAcceleratorKey_string , ZLANG_OBJECT_guimenuitem , "SetAcceleratorKey" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_SetChecked_bool , ZLANG_OBJECT_guimenuitem , "SetChecked" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guiwidget_all_common_functions( menuitem )

	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guictl_all_common_functions( menuitem )

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_IsChecked , ZLANG_OBJECT_bool , "IsChecked" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guimenuitem_ToggleCheck , ZLANG_OBJECT_void , "ToggleCheck" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	return obj ;
}

